This invention relates to a microprogram control circuit, which controls the setting of a return address used to exit from a subroutine in order to return to a desired point in a main program, when a return instruction included in a microprogram is executed.
A typical microprogram control circuit for use in a computer, a control device, etc., which employs a microprogram control system, performs various control functions according to micro instructions latched from a control storage. When a micro instruction, BAL (Branch And Link), is latched from the control storage, a return address to return to a main program (i.e., the next address to that where the BAL instruction is located in the main program) is latched into a stack register, and branching to a subroutine, whose start address is the branch address set in the address field of the BAL instruction, is executed. The last micro instruction of this subroutine is RTN (Return). When this RTN instruction is read out from the control storage, the return address held in the stack register is latched out, causing the program sequence to return to the particular point in the main program which is designated by that return address.
FIG. 1 illustrates an example of two types of microprograms A and B. Microprogram A consists of program blocks A1, S1, S2, S3, A2, and A3, while microprogram B consists of program blocks B1, S1, S2, S3, B2, and B3. As should be clear from this drawing, programs A and B have a common program section 10 (dotted region) that consists of blocks S1, S2, and S3. Accordingly, implementing common program section 10 as a subroutine can reduce the overall amount of program code, as well as the total number of individual programs.
However, the return address to return from common program section 10 to program A or B varies depending on whether the control returns from block S2 or block S3. According the prior art technique, therefore, the entire common program section 10 cannot be implemented as a single subroutine, thereby simply leaving a choice of either using programs A and B of FIG. 1 individually as they are, or of forming a subroutine only for block S1 (see FIG. 2), which has a single return address. Consequently, known microprogram control circuits require a larger size of, and thus more complicated, microprograms.